package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Getter
@Setter
public class Notice {
    private Long id;
    //发布人
    private Employee issuer;
    //发布时间
    private Date pubdate;
    //公告标题
    private String title;
    //公告内容
    private String content;
    //是否已读
    private boolean read = false;
    //用户集合
//    private List<Long> eids = new ArrayList<>();

    public String getJson() {
        HashMap map = new HashMap();
        map.put("id",id);
//        map.put("pubdate",pubdate);
        map.put("title",title);
        map.put("content",content);
//        map.put("read",read);
        if (issuer != null) {
            map.put("issuerId",issuer.getId());
        }
        //不能直接传this进去,会出现死循环
        return JSON.toJSONString(map);
    }
}